<!DOCTYPE html>
<head>
<meta charset="utf-8" />
<title>鲅鱼圈便民信息发布管理系统</title>
<meta name="description" content="app, web app, responsive, admin dashboard, admin, flat, flat ui, ui kit, off screen nav" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
    <link rel="stylesheet" href="${s.base}/css/bootstrap.4.0.css" type="text/css" />
<link rel="stylesheet" href="${s.base}/css/app.v2.css" type="text/css" />
  <link rel="stylesheet" href="${s.base}/css/bootstrap-table.css" type="text/css" />
<style type="text/css">
  html,body{
    background-color: #ffffff;
  }
</style>
</head>

<body>
<section class="panel-default">
  <div class="panel-body">
    <form class="bs-example form-horizontal" action="UpdateOrAddEntity" method="post">
        <input type="hidden" id="flag" name="flag" value="${baseUser.userid}" />
        <div class="form-group">
            <label class="col-xs-3 control-label col-sm-offset-2" style="text-align:right;">题目:</label>
            <div class="col-xs-8 col-sm-offset-2" style="margin-top: 8px;">
                ${baseNote.title}
            </div>
        </div>
        <div class="form-group">
            <label class="col-xs-3 control-label col-sm-offset-2" style="text-align:right;">发布人:</label>
            <div class="col-xs-8 col-sm-offset-2" style="margin-top: 8px;">
                ${baseNote.sendname}
            </div>
        </div>
      <div class="form-group">
        <label class="col-xs-3 control-label col-sm-offset-2" style="text-align:right;">发布内容:</label>
        <div class="col-xs-8 col-sm-offset-2" style="margin-top: 8px;">
            ${baseNote.content}
        </div>
      </div>
        <div class="form-group">
            <label class="col-xs-3 control-label col-sm-offset-2" style="text-align:right;">发布时间:</label>
            <div class="col-xs-8 col-sm-offset-2" style="margin-top: 8px;">
                ${baseNote.createtime?string("yyyy-MM-dd")}
            </div>
        </div>
      <div class="line line-dashed line-lg pull-in"></div>


    </form>
  </div>
</section>
<script src="${s.base}/js/jquery-3.2.0.min.js"></script>
<script src="${s.base}/js/layer/layer.js"></script>
<script src="${s.base}/js/layer/commont.js"></script>
<script src="${s.base}/js/bootstrap.4.0.js"></script>
<script src="${s.base}/js/bootstrap-table.js"></script>
<script src="${s.base}/js/bootstrap-table-zh-CN.js"></script>
<script type="text/javascript">
/**
 * 修改信息
 * */
function isUpdate(){
    $("#username").removeAttr("readonly");
    $("#userpassword").removeAttr("readonly");
    $("#isUpdate").show();
    $("#isNoUpdate").hide();
}
function isNoUpdate(){
    $("#username").attr("readonly","true");
    $("#userpassword").attr("readonly","true");
    $("#isUpdate").hide();
    $("#isNoUpdate").show();
}
/**
  * 添加或修改
  */
 function updateOrAdd() {
     var userid=$("#userid").val();

     if (userid==null || ""==userid){
         layer.alert("请输入登录名！");
         return false;
     }
    var reg=/^[a-z A-Z_0-9]{5,12}$/;
    if (!reg.exec(userid)) {
        layer.alert("请输入5-12位字符串！");
        return false;
    }
     var userName=$("#username").val();
     if (userName==null || ""==userName){
         layer.alert("请输入用户名！");
         return false;
     }
     var password=$("#userpassword").val();
     if (password==null || ""==password){
         layer.alert("请输入登录密码！");
         return false;
     }
    if (!reg.exec(password)) {
        layer.alert("请输入5-12位字符串！");
        return false;
    }
     $.ajax({
         type: "POST",
         url: "/user/Update",
         data: {"userid":userid,"username":userName,"userpassword":password},
         success: function(result){
             parentLayerClose();
             if(1==result.returnInfo.state){
                 parent.showLayerAlertNoRefre("个人信息修改成功");
             }else{
                 parent.showLayerAlertNoRefre(result.returnInfo.errorMsg);
             }
         },
         error: function(result){
             parent.showLayerAlertNoRefre(result);
         }
     });
 }
</script>
</body>
</html>
